Hello,
I have strange behaviour in this script. I have two layout scripts and third layout script is doing compare on 1 & 2. It acts strangly. It will only refresh few objects and then loops back to start and is getting to deadlock.
if I don't include 3rd column, 1 & 2 column refreshes fine.
Here is the compare layout DXL:
// =============================================================================
string textOrig(Column col, Object obj){string s = text(col, obj); return s}
// =============================================================================
Buffer gbColumnValue = create()
pragma runLim, 0
string prefCode;
string lineSep = "\n"
prefCode = "
Buffer bres = addr_ " ((addr_ gbColumnValue ) int) "\n
setempty bres
void displayRich (string x) {if (length bres > 0){bres += \"" lineSep "\"}; bres += x}
void display (string x) {if (length bres > 0){bres += \"" lineSep "\"}; bres += x}
void display (Attr__ x) {Buffer c = create(); c = x; if (length bres > 0){bres += \"" lineSep "\"}; bres += c; delete c;}
void displayRichWithColour (string x) {if (length bres > 0){bres += \"" lineSep "\"}; bres += x}
void displayRichWithColor (string x) {if (length bres > 0){bres += \"" lineSep "\"}; bres += x}
"
string text(Column col, Object obj)
{
string returnValue = ""
gbColumnValue = ""
if (!main col && attrName col == "" )
{
Buffer code = create()
code += "Object obj = addr_ " ((addr_ obj) int) "\n"
code += "attrDXLName = \"" attrDXLName "\"\n"
code += prefCode; code += dxl col; code += "\n"
noError()
(current ModuleRef__) = module obj
eval_ tempStringOf code
string errMsg = lastError()
delete code
}
else if (attrName col != "")
{
gbColumnValue = probeAttr_ (obj, attrName col)
}
else if (main col)
{
Buffer oh = create()
oh = obj."Object Heading"
Buffer ot = create()
ot = obj."Object Text"
gbColumnValue = ""
gbColumnValue += oh
if (length gbColumnValue > 0){gbColumnValue += "\n"}
gbColumnValue += ot
delete oh
delete ot
}
return stringOf gbColumnValue
}
string Text=""
Buffer bufCur = create()
bufCur = plainText text(column 1, obj)
Buffer bufOld = create()
bufOld= plainText text(column 2, obj)
string strLog = "c:/temp/execution-log-col3.txt"
Stream strmLog = append strLog // create execution log file
if (bufCur != bufOld)
{
strmLog << identifier obj "," //
theis line prints objects twice WPNS_12737,WPNS_12737,WPNS_17290,WPNS_17290,WPNS_12739,WPNS_12739--repeat--WPNS_12737,WPNS_12737,
Buffer bufDiff = create()
diff(bufDiff, bufOld, bufCur, "\\b\\cf3\\ul ", "\\b\\cf1\\strike ")
displayRichWithColor tempStringOf(bufDiff)
delete bufDiff
}
delete(bufOld)
delete(bufCur)
close strmLog
// any idea what is happening here. is there a limit on DXL columns in a view?
jester76 - Tue Sep 25 10:02:58 EDT 2012 |
|
Re: Dynamic Layout column compare Mathias Mamsch - Wed Sep 26 15:52:50 EDT 2012
The first thing that happens here is, that your code is barely readable, since you did not use the {c o d e} ... {c o d e} in your post to wrap the code parts.
The second thing is, that it is normal for DXL Layout to be calculated multiple times. There are multiple runs where the DXL Layout is executed, at least one measuring part, which only determines how high the column will become and a second run, which will actually render the column. In the past we found that sometimes a DXL Layout is calculated more than twice.
The problem with the deadlock would seem reasonable to me if your third column somehow influenced the display of the first two columns therefore constantly changing the display without ever getting a stable result. But I cannot see, how that would happen. I guess you need to experiment a bit to get a reproducable result. Replace the two DXL Layouts by a constant text. Then try if the code still crashes. If so, post the code of the three columns. You might also want to try to comment out only the display part of the compare column and see if the crashes go away. Regards, Mathias
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
|
|
Re: Dynamic Layout column compare llandale - Thu Sep 27 12:28:46 EDT 2012
You need to turn these into Attr-DXLs. This will resolve the thrashing problem these huge Layouts have, and will guarantee the parts are calculated in the correct order.
I have seen some strange things with columns losing their "context" but cannot put my finger on it.
-Louie
|
|
Re: Dynamic Layout column compare Peter_Albert - Fri Sep 28 04:11:48 EDT 2012 llandale - Thu Sep 27 12:28:46 EDT 2012
You need to turn these into Attr-DXLs. This will resolve the thrashing problem these huge Layouts have, and will guarantee the parts are calculated in the correct order.
I have seen some strange things with columns losing their "context" but cannot put my finger on it.
-Louie
In addition to the above two comments, I don't think it is a good idea to write to Streams from within layout DXL. Firstly, as you observed, content is put to the file multiple times, as the layout DXL is executed quite often. Secondly, the Stream handles create memory leaks, which might explain the deadlock.
Regards,
Peter
|
|
Re: Dynamic Layout column compare llandale - Fri Sep 28 15:12:01 EDT 2012 Peter_Albert - Fri Sep 28 04:11:48 EDT 2012
In addition to the above two comments, I don't think it is a good idea to write to Streams from within layout DXL. Firstly, as you observed, content is put to the file multiple times, as the layout DXL is executed quite often. Secondly, the Stream handles create memory leaks, which might explain the deadlock.
Regards,
Peter
Didn't notice the Stream. Even if he adds the Date/Time to the log entry, closes the Stream and delete the handle, it's a disaster in a Layout because of how often it is recalculated. Doing this log in a Attr-DXL isn't so bad; but the log file will get real big and I notice that different folks will need to have the SAME log file and path on each of their client PCs, which I don't think is realistic.
If I REALLY must log, I'd be tempted to do this:
-
if file c:\MyFolder\MySillyDebug.on exists then print dateAndTime(today() "\tNameOfLayout\t" identifier(obj) "\n"
Then you can turn on logging on by creating that file (or renaming it from MySillyDebug.off to .on); and other folks will never have that file and so won't get printed at.
-Louie
|
|